export function transTreeData(list) {
  // 定义树形数据
  const treeArr = []
  // 定义映射对象
  const mapObj = {}
  list.forEach(ele => {
    if (!ele.children) {
      ele.children = []
      mapObj[ele.id] = ele
    }
  })
  list.forEach((item) => {
    const people = mapObj[item.pid]
    if (!people) return treeArr.push(item)
    people.children.push(item)
  })
  return treeArr
}
